Skip to content

Conversation

geril07
Copy link

@geril07 geril07 commented Jul 23, 2025

Problem:
There’s a window(resolve_timeout_ms) where you can do anything (like switch to Normal mode) between selecting a completion item and LSP resolving it. The problem is that vim.fn.complete throws an error outside of Insert mode. So if you type Tab -> Esc you can hit this problem if an LSP will take some time to resolve. Happens to me every day or two.

Solution: Wrap it into pcall and notify a user that dot repeat logic is failed. But I am not sure about the message format, maybe you can find a better one.

Before

before.mp4

After

after.mp4

But it opens up another problem. As you can see in the "after" demo, there's an incorrect t character left at the end of the completion. This happens because switching to Normal mode decreases the cursor's column position by 1, so the last character isn’t cleared.
Still, I think it’s better to deal with an extra character than with the original error.

I described more about this there #1491.

@Saghen
Copy link
Owner

Saghen commented Jul 24, 2025

In #2022, I decided to check if the mode was not insert, and ignore the dot-repeat call if so, without a warning message. I also included some other fixes for when the cursor moves while resolving. Could you give that PR a try and lmk what you think?

@Saghen
Copy link
Owner

Saghen commented Sep 2, 2025

Closing in favor of #2022. Thanks again for all your help on that one

@Saghen Saghen closed this Sep 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants